package cn.demoncat.util.lang.constant;

/**
 * 授权码常量
 * 
 * @author 延晓磊
 *
 * @since 2017年10月24日
 */
public final class AllowCodeConstant {
	
	/**
	 * 消息
	 */
	public static final class Msg{
		/**
		 * 权限码错误
		 */
		public static final String CODE_ERROR = "权限码错误";
		/**
		 * 没有权限
		 */
		public static final String COMMON = "没有权限";
		/**
		 * 没有读权限
		 */
		public static final String READ_BAN = "对不起，您没有查看权限";
		/**
		 * 没有写权限
		 */
		public static final String WRITE_BAN = "对不起，您没有编辑权限";
		/**
		 * 没有删权限
		 */
		public static final String DELETE_BAN = "对不起，您没有删除权限";
	}
	
	/**
	 * 权限码
	 */
	public static final class Code{
		/**
		 * 有效的权限码集(校验使用，不属于权限码)
		 */
		public static final String ANY = "01357";
		
		/**
		 * 无权限
		 */
		public static final String NONE = "0";
		/**
		 * 读
		 */
		public static final String READ = "1";
		/**
		 * 写
		 */
		public static final String WRITE = "2";
		/**
		 * 删		
		 */
		public static final String DELETE = "4";
		/**
		 * 读写		
		 */
		public static final String READ_WRITE = "3";
		/**
		 * 读删		
		 */
		public static final String READ_DELETE = "5";
		/**
		 * 读写删
		 */
		public static final String ALL = "7";
	}
	
	/**
	 * 权限码（数字类型）
	 */
	public static final class CodeNum{
		 
		/**
		 * 无权限
		 */
		public static final int NONE = 0;
		/**
		 * 读
		 */
		public static final int READ = 1;
		/**
		 * 写
		 */
		public static final int WRITE = 2;
		/**
		 * 删		
		 */
		public static final int DELETE = 4;
		/**
		 * 读写		
		 */
		public static final int READ_WRITE = 3;
		/**
		 * 读删		
		 */
		public static final int READ_DELETE = 5;
		/**
		 * 读写删
		 */
		public static final int ALL = 7;
	}
	
	/**
	 * 团队权限码
	 */
	public static final class TeamCode{
		
		/**
		 * 个人只读
		 */
		public static final String SELF_READ = "100";
		/**
		 * 团队只读
		 */
		public static final String TEAM_READ = "110";
		/**
		 * 全部只读
		 */
		public static final String ALL_READ = "111";
		
		/**
		 * 个人读写
		 */
		public static final String SELF_RW = "300";
		/**
		 * 个人读写，团队读
		 */
		public static final String SELF_RW_TEAM_R = "310";
		/**
		 * 个人读写，团队读,全部读
		 */
		public static final String SELF_RW_TEAM_R_ALL_R = "311";
		/**
		 * 团队读写
		 */
		public static final String TEAM_READ_WRITE = "330";
		/**
		 * 团队读写，全部读
		 */
		public static final String TEAM_RW_ALL_R = "331";
		/**
		 * 全部读写
		 */
		public static final String ALL_READ_WRITE = "333";
 
		/**
		 * 个人读写删
		 */
		public static final String SELF_ALL = "700";
		/**
		 * 个人读写删，团队读
		 */
		public static final String SELF_ALL_TEAM_R = "710";
		/**
		 * 个人读写删，团队读,全部读
		 */
		public static final String SELF_ALL_TEAM_R_ALL_R = "711";
		/**
		 * 个人读写删，团队读写
		 */
		public static final String SELF_ALL_TEAM_RW = "730";
		/**
		 * 个人读写删，团队读写,全部读
		 */
		public static final String SELF_ALL_TEAM_RW_ALL_R = "731";
		/**
		 * 团队读写删
		 */
		public static final String TEAM_ALL = "770";
		/**
		 * 团队读写删，全部读
		 */
		public static final String TEAM_ALL_ALL_R = "771";
		/**
		 * 团队读写删，全部读写
		 */
		public static final String TEAM_ALL_ALL_RW = "773";
		/**
		 * 全部读写删
		 */
		public static final String ALL_ALL = "777";
	}
	
	/**
	 * 团体权限的授权角色
	 * 
	 * @author 延晓磊
	 *
	 * @since 2017年10月24日
	 */
	public enum TeamRole{
		/**
		 * 自己
		 */
		SELF(0),
		/**
		 * 团队
		 */
		TEAM(1),
		/**
		 * 所有人
		 */
		ALL(2);
		
		//角色权限码索引
		private final int index;
		
		TeamRole(int index){
			this.index = index;
		}

		public int getIndex() {
			return index;
		}

	}
}
